import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../components/admin/Home.vue'
import System from '../components/admin/System.vue'
import User from '../components/admin/User.vue'
import Admin from '../components/Admin.vue'
import Login from '../components/Login.vue'
import ChatHub from '../components/ChatHub.vue'
import Chat from '../components/Chat/Chat.vue'
import Friend from '../components/Chat/Friend.vue'
import CreateUser from '../components/CreateUser.vue'
Vue.use(VueRouter)
const routes = [
  {
    path: '/',
    name: '/',
    component: Admin,
    children:[
      {
        path: '/Admin/',
        name: '/Admin/Home',
        component: Home
      },{
        path: '/Admin/User',
        name: '/Admin/User',
        component: User
      },{
        path: '/Admin/System',
        name: '/Admin/System',
        component: System
      }
    ]
  },
  {
    path: '/CreateUser',
    name: '/CreateUser',
    component: CreateUser
  },
  {
    path: '/Login',
    name: '/Login',
    component: Login
  },
  {
    path: '/Chat',
    name: '/Chat',
    component: ChatHub,
    children:[{
      path: '/Chat/Chat',
      name: '/Chat/Chat',
      component: Chat
    },{
      path: '/Chat/Friend',
      name: '/Chat/Friend',
      component: Friend
    }
    ]
  },
]
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
const router = new VueRouter({
  routes
})

export default router
